package com.attilax.researchUtil;

import java.io.File;
import java.util.Map;
import java.util.Map.Entry;

import com.attilax.Closure;
import com.attilax.io.dirx;
import com.attilax.io.filex;
 
 

public class CountFilesUnderFolders {

	public static void main(String[] args) {
		final Map m=com.google.common.collect.Maps.newLinkedHashMap();
		 final String strPath = "D:\\workspace 空格\\AtiPlatf\\src_atibrow\\com\\attilax";
		//  dirx.trave(strPath, closure);
		dirx.trave(strPath, new Closure () {

			@Override
			public Object execute(Object arg0) throws Exception {
				 String f=(String) arg0;
				 f=f.replace(strPath, "");				 
				 String[] cols=f.split("\\\\");
				 String parent_dir_name=cols[1];
				 if(m.get(parent_dir_name)==null)
				 {
					 m.put(parent_dir_name, 1);
					 return null;
					 }
				int now=(Integer) m.get(parent_dir_name);
				 m.put(parent_dir_name, now+1);
			
				 
				 
					 
				return null;
			}
		});
		
		for (Object e1 : m.entrySet()) {
			Entry e=(Entry) e1;
			System.out.println(e.getKey()+","+e.getValue());
		}
		System.out.println("---f");

	}

}
